
import java.util.HashMap;
import java.util.Map;

public class Main {
    public static int solution(int[] cards) {
        Map<Integer, Integer> counter = new HashMap<>();
        for (int card: cards) {
            counter.put(card, counter.getOrDefault(card, 0) + 1);
        }
        for (Map.Entry<Integer, Integer> entry : counter.entrySet()) {
            if (entry.getValue() == 1) {
                return entry.getKey();
            }
        }
        return -1; // 如果没有找到唯一数字，返回-1
    }

    public static void main(String[] args) {
        System.out.println(solution(new int[]{1, 1, 2, 2, 3, 3, 4, 5, 5}) == 4);
        System.out.println(solution(new int[]{0, 1, 0, 1, 2}) == 2);
    }
}
